﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MCPlatform.Communicate.SerialPorts
{
    public interface ISerialPort
    {
        public event Action<string> SerialReceivedDataEvent;

        public event Action<string> SerialReceivedDataEventByHex;

        // public SerialComInfo SerialComInfo { get; set; }
        public bool IsOpen { get; }

        public string DeviceName { get; set; }
        public string ReceivedStr { get; }
        public void OpenSerialPort();
        public void CloseSerialPort();

        public Task SendData(params string[] sendString);

        public void SendData(string sendString);


        public Task<string> SendDataAndGetReply(double timeSpan = 1000, params string[] sendString);

        public Task<string> SendDatasAndGetReply(double timeSpan = 1000, params string[] sendString);
        public Task<string> SendDatasAndGetNumberReply(double timeSpan = 1000, params string[] sendString);

        public Task<string> SendDataByHexAndGetReply(double timeSpan = 100, params string[] sendString);


        public  Task<string?> SendAndReceiveAsync(TimeSpan timeout, params string[] sendString);
        public void SendDataByHex(string hexData);

    }
}
